Tuesday, September 28, 2004

In VB.NET, use DirectCast instead of CType

Visual Basic .NET provides two options for casting. CType casts or converts one type into another type. If the types do not match, coercion may be performed. DirectCast casts one type to another type but does not perform corecion if the types do not match. The main difference between the two is that DirectCast is only works if the specified type and the run-time type of the expression are the same.


With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/

0 Comments:

Post a Comment

<< Home